﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace E.Y.E.Jobs
{
    class CommandUnknown : ICommand
    {
        private const string MESSAGE_COMMAND_TITLE = "/=======UNKNOWN COMMAND=======\\";
        private const string ERROR_MESSAGE_FAIL_EDITING = "So embarrasing. We cannot recognize your command.";

        String Message;
        bool ErrorFlag;

        public CommandUnknown()
        {
            Message = "";
            ErrorFlag = true;
        }

        public bool Execute(ref TaskManager taskDatabase,ref CommandTypeManager CommandTypeDatabase,ref History actionsHistory)
        {
            ErrorFlag = true;
            Message = ERROR_MESSAGE_FAIL_EDITING;
            return false;
        }

        public bool Undo(ref TaskManager taskDatabase, ref CommandTypeManager CommandTypeDatabase, ref History actionsHistory)
        {
            // NOT UNDO operation for Unknown command
            return false;
        }

        public string getCommandEventTitle()
        {
            return MESSAGE_COMMAND_TITLE;
        }

        public void setMessage(string desiredMessage)
        {
            Message = desiredMessage;
        }

        public string getMessage()
        {
            return Message;
        }

        public void SetError(bool desiredBool)
        {
            ErrorFlag = desiredBool;
        }

        public bool GetErrorState()
        {
            return ErrorFlag;
        }

        public InformationPackage ConvertToInfoPackage()
        {
            InformationPackage Result = new InformationPackage();

            Result.CommandType = InformationPackageEnumClass.CommandType.UnknownCommand;
            Result.Message = Message;

            return Result;
        }
    }
}
